from dataclasses import field

from marshmallow.validate import Length, Email
from marshmallow_dataclass import dataclass as mm_dataclass


@mm_dataclass
class MemberCreateReq:
    name: str = field(
        metadata={
            "description": "姓名",
            "example": "李四",
            "validate": Length(min=2, max=20)
        }
    )
    email: str = field(
        metadata={
            "description": "邮箱",
            "example": "abc@qq.com",
            "validate": Email()
        }
    )
    # age: str = field(
    #     default=18,
    #     metadata={
    #         # "description": "年龄",
    #         # "example": "18",
    #         "validate": lambda x: 1 <= x <= 150
    #     }
    # )
